/*
 * 作者:熊猫
 * 日期:2017 - 3 - 20 9 - 51 - 4
 *
 */

package net.lainiao.morethread.Chapter7.demo11;

import java.util.concurrent.CountDownLatch;

/**
 * Created by Administrator on 2017/3/20.
 */
public class Main {
    public static void main(String[] args) {
        ParkingCounter parkingCounter=new ParkingCounter(5);
        Sensor1 sensor1=new Sensor1(parkingCounter);
        Sensor2 sensor2=new Sensor2(parkingCounter);
        Thread thread1=new Thread(sensor1);
        Thread thread2=new Thread(sensor2);
        thread1.start();
        thread2.start();
        try {
            thread1.join();
            thread2.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("Main : Number of cars :"+ parkingCounter.get());
        System.out.println("Main over");
    }
}
